<template>
  <s-modal title="详情" :visible="visible" width="800px" :footer="null" @cancel="visible = false">
    <div style="height: 400px">
      <s-scroll>
        <s-form ref="form" :value="formValue">
          <s-form-item label="父级权限">
            <s-select-tree
              ref="parentId"
              v-model="formValue.parentId"
              allow-clear
              url="/authority/permission/selectList"
              value-field="id"
              disabled
            />
          </s-form-item>

          <s-form-item label="权限名称">
            <s-input v-model="formValue.text" allow-clear disabled />
          </s-form-item>
          <s-form-item label="权限标识">
            <s-input v-model="formValue.value" allow-clear disabled />
          </s-form-item>
          <s-form-item label="排序号">
            <s-input-number v-model="formValue.orderNum" :min="1" :max="999" disabled />
          </s-form-item>
          <s-form-item label="创建人">
            <s-input v-model="formValue.createByAccount" disabled />
          </s-form-item>
          <s-form-item label="创建时间">
            <s-input v-model="formValue.createDate" disabled />
          </s-form-item>
          <s-form-item label="修改人">
            <s-input v-model="formValue.updateByAccount" disabled />
          </s-form-item>
          <s-form-item label="修改时间">
            <s-input v-model="formValue.updateDate" disabled />
          </s-form-item>
          <s-form-item label="备注" size="big">
            <s-text-area v-model="formValue.remark" allow-clear disabled />
          </s-form-item>
        </s-form>
      </s-scroll>
    </div>
  </s-modal>
</template>

<script>
export default {
  name: 'Detail',
  data() {
    return {
      formValue: {},
      visible: false
    }
  },
  methods: {
    open(id) {
      this.$loading(true)
      this.$api
        .GET('/authority/permission/selectOneById', { id: id })
        .then((res) => {
          if (!res.data) {
            this.$loading(false)
            this.visible = false
            this.$message.warn('数据不存在')
          } else {
            this.formValue = res.data
            this.$loading(false)
            this.visible = true
          }
        })
        .catch(() => {
          this.$loading(false)
        })
    }
  }
}
</script>

<style lang="less" scoped></style>
